﻿using B.S.BasicData.Infrastructure.Interface;
using Microsoft.AspNetCore.Mvc.Filters;

namespace B.S.BasicData.Api.Read.Filter
{
    public class GetFilter : IExceptionFilter
    {
        private readonly ILogger<GetFilter> logger;

        public GetFilter(ILogger<GetFilter>logger)
        {
            this.logger = logger;
        }
        public void OnException(ExceptionContext context)
        {
            logger.LogError("发生全局异常"+context.Exception.Message);
            context.ExceptionHandled = true;
        }
    }
}
